
package com.xm9m.ibczy.mytest.alimama.mobile.demo;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.Toast;

import com.alimama.mobile.sdk.config.system.MMLog;
import com.xm9m.ibczy.mytest.R;

public class FeedMojiActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.moji_feed);
        final ViewGroup vp = (ViewGroup)findViewById(R.id.mojibanner);
        vp.setVisibility(View.GONE);
        MojiBanner mojiBanner = new MojiBanner(this) {
            @Override
            public void onImageLoad(String url, final ImageView imageView) {
                new ImageLoadTask(url) {
                    @Override
                    public void onRecived(Drawable result) {
                        if(result != null){
                            imageView.setImageDrawable(result);
                        }else{
                            Toast.makeText(FeedMojiActivity.this, "图片获取失败", Toast.LENGTH_SHORT).show();
                        }
                    }
                }.execute();
                int[] size = getSize();
                MMLog.i("########## w="+size[0]+" h="+size[1]);
                vp.setVisibility(View.VISIBLE);
            }
        };

        vp.addView(mojiBanner, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        mojiBanner.init(this,"65465");
    }

}
